package com.dhj.test;

import java.util.HashMap;
import java.util.Map;

public class HashFind {

    public static void main(String[] args) {
        int[] nums = new int[]{2,7,11,15};

        Map map = new HashMap();
        int target = 13;

        for (int i = 0; i < nums.length; i++) {
            if(map.containsKey(target - nums[i])){
                System.out.println(map.get(target - nums[i])+" "+i);
            }else{
                map.put(nums[i], i);
            }
        }

    }

}
